#ifndef __IOFILEMGRFORUSER_H
#define __IOFILEMGRFORUSER_H

#include "__Kernel.h"

#define SCE_STM_FDIR 0x1000
#define SCE_STM_FREG 0x2000
#define SCE_STM_FLNK 0x4000

enum
{
    TYPE_DIR = 0x10,
    TYPE_FILE = 0x20 
};

typedef struct
{
    u32 handle;
    u64 asyncResult;
} FileNode;

/* Date and time. */
typedef struct
{
    u16 year;
    u16 month;
    u16 day;
    u16 hour;
    u16 minute;
    u16 second;
    u32 microsecond;
} ScePspDateTime;

/** Structure to hold the status information about a file */
typedef struct
{
    SceMode st_mode;
    u32 st_attr;
    /** Size of the file in bytes. */
    SceOff st_size;
    /** Creation time. */
    ScePspDateTime st_ctime;
    /** Access time. */
    ScePspDateTime st_atime;
    /** Modification time. */
    ScePspDateTime st_mtime;
    /** Device-specific data. */
    u32 st_private[6];
} SceIoStat;

typedef struct
{
    char *name;
    FileInfo *listing;
    s32 nlisting;
    s32 index;
} DirListing;

void __IoInit();
void __IoSetPath(char *path);
void __IoShutdown();
void __IoGetStat(SceIoStat *stat, FileInfo info);
u32 __IoClose(SceUID id);
void __IoAddDirHandle(SceUID id);
void __IoDelDirHandle(SceUID id);

#endif

